package com.qq.weixin.mp.api.pay.model;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;

import com.hxexp.weixin.common.jaxb.CDATAAdapter;

/**
 * 统一下单接口参数
 * 参考文档：http://mch.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_1
 * @author li.jiang
 *
 */
@XmlRootElement(name = "xml")
@XmlAccessorType(XmlAccessType.FIELD)
public final class UnifiedOrderParamJaxb extends CommonParamJaxb {

    private static final long serialVersionUID = 9179326008795659438L;
    /**
     * 设备号【终端设备号(门店号或收银设备ID)，注意：PC网页或公众号内支付请传"WEB"】
     */
    @XmlElement(name = "device_info")
    private String deviceInfo;
    /**
     * 商品或支付单简要描述(最长32个字符)
     */
    private String body;
    /**
     * 商品详情(最长8192个字符)
     */
    @XmlJavaTypeAdapter(value = CDATAAdapter.class)
    private String detail;
    /**
     * 附加数据(最长127个字符, 在查询API和支付通知中原样返回，该字段主要用于商户携带订单的自定义数据)
     */
    @XmlJavaTypeAdapter(value = CDATAAdapter.class)
    private String attach;
    /**
     * 商户订单号(最长32位，可包含字母，微信支付要求商户订单号保持唯一性)
     */
    @XmlElement(name = "out_trade_no")
    private String outTradeNo;
    /**
     * 货币类型(符合ISO 4217标准的三位字母代码，默认人民币：CNY)
     */
    @XmlElement(name = "fee_type")
    private String feeType;
    /**
     * 总金额
     */
    @XmlElement(name = "total_fee")
    private Integer totalFee;
    /**
     * 终端IP(APP和网页支付提交用户端ip)
     */
    @XmlElement(name = "spbill_create_ip")
    private String spbillCreateIp;
    /**
     * 交易起始时间(订单生成时间，格式为yyyyMMddHHmmss)
     */
    @XmlElement(name = "time_start")
    private String timeStart;
    /**
     * 交易结束时间(订单失效时间，格式为yyyyMMddHHmmss)
     */
    @XmlElement(name = "time_expire")
    private String timeExpire;
    /**
     * 商品标记(商品标记，代金券或立减优惠功能的参数)
     */
    @XmlElement(name = "goods_tag")
    private String goodsTag;
    /**
     * 通知地址(接收微信支付异步通知回调地址)
     */
    @XmlElement(name = "notify_url")
    private String notifyUrl;
    /**
     * 交易类型(微信服务号内部网页支付使用JSAPI)
     */
    @XmlElement(name = "trade_type")
    private String tradeType;
    /**
     *商品ID(trade_type=NATIVE，此参数必传。此id为二维码中包含的商品ID，商户自行定义。)
     */
    @XmlElement(name = "product_id")
    private String productId;
    /**
     * 用户标识(trade_type=JSAPI，此参数必传，用户在商户appid下的唯一标识。下单前需要调用【网页授权获取用户信息】接口获取到用户的Openid)
     */
    @XmlElement(name = "openid")
    private String openId;
    /**
     * @return the deviceInfo
     */
    public String getDeviceInfo() {
        return deviceInfo;
    }
    /**
     * @param deviceInfo the deviceInfo to set
     */
    public void setDeviceInfo(String deviceInfo) {
        this.deviceInfo = deviceInfo;
    }
    /**
     * @return the body
     */
    public String getBody() {
        return body;
    }
    /**
     * @param body the body to set
     */
    public void setBody(String body) {
        this.body = body;
    }
    /**
     * @return the detail
     */
    public String getDetail() {
        return detail;
    }
    /**
     * @param detail the detail to set
     */
    public void setDetail(String detail) {
        this.detail = detail;
    }
    /**
     * @return the attach
     */
    public String getAttach() {
        return attach;
    }
    /**
     * @param attach the attach to set
     */
    public void setAttach(String attach) {
        this.attach = attach;
    }
    /**
     * @return the outTradeNo
     */
    public String getOutTradeNo() {
        return outTradeNo;
    }
    /**
     * @param outTradeNo the outTradeNo to set
     */
    public void setOutTradeNo(String outTradeNo) {
        this.outTradeNo = outTradeNo;
    }
    /**
     * @return the feeType
     */
    public String getFeeType() {
        return feeType;
    }
    /**
     * @param feeType the feeType to set
     */
    public void setFeeType(String feeType) {
        this.feeType = feeType;
    }
    /**
     * @return the totalFee
     */
    public Integer getTotalFee() {
        return totalFee;
    }
    /**
     * @param totalFee the totalFee to set
     */
    public void setTotalFee(Integer totalFee) {
        this.totalFee = totalFee;
    }
    /**
     * @return the spbillCreateIp
     */
    public String getSpbillCreateIp() {
        return spbillCreateIp;
    }
    /**
     * @param spbillCreateIp the spbillCreateIp to set
     */
    public void setSpbillCreateIp(String spbillCreateIp) {
        this.spbillCreateIp = spbillCreateIp;
    }
    /**
     * @return the timeStart
     */
    public String getTimeStart() {
        return timeStart;
    }
    /**
     * @param timeStart the timeStart to set
     */
    public void setTimeStart(String timeStart) {
        this.timeStart = timeStart;
    }
    /**
     * @return the timeExpire
     */
    public String getTimeExpire() {
        return timeExpire;
    }
    /**
     * @param timeExpire the timeExpire to set
     */
    public void setTimeExpire(String timeExpire) {
        this.timeExpire = timeExpire;
    }
    /**
     * @return the goodsTag
     */
    public String getGoodsTag() {
        return goodsTag;
    }
    /**
     * @param goodsTag the goodsTag to set
     */
    public void setGoodsTag(String goodsTag) {
        this.goodsTag = goodsTag;
    }
    /**
     * @return the notifyUrl
     */
    public String getNotifyUrl() {
        return notifyUrl;
    }
    /**
     * @param notifyUrl the notifyUrl to set
     */
    public void setNotifyUrl(String notifyUrl) {
        this.notifyUrl = notifyUrl;
    }
    /**
     * @return the tradeType
     */
    public String getTradeType() {
        return tradeType;
    }
    /**
     * @param tradeType the tradeType to set
     */
    public void setTradeType(String tradeType) {
        this.tradeType = tradeType;
    }
    /**
     * @return the productId
     */
    public String getProductId() {
        return productId;
    }
    /**
     * @param productId the productId to set
     */
    public void setProductId(String productId) {
        this.productId = productId;
    }
    /**
     * @return the openId
     */
    public String getOpenId() {
        return openId;
    }
    /**
     * @param openId the openId to set
     */
    public void setOpenId(String openId) {
        this.openId = openId;
    }
    /* (non-Javadoc)
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        return String
                .format("UnifiedOrderParamJaxb [deviceInfo=%s, body=%s, detail=%s, attach=%s, outTradeNo=%s, feeType=%s, totalFee=%s, spbillCreateIp=%s, timeStart=%s, timeExpire=%s, goodsTag=%s, notifyUrl=%s, tradeType=%s, productId=%s, openId=%s, appId=%s, mchId=%s, nonceStr=%s, sign=%s]",
                        deviceInfo, body, detail, attach, outTradeNo, feeType, totalFee, spbillCreateIp, timeStart,
                        timeExpire, goodsTag, notifyUrl, tradeType, productId, openId, getAppId(), getMchId(),
                        getNonceStr(), getSign());
    }

}
